fix(ui): validate OOBM is enabled before allowing HA on KVM hosts (#13605) - #13647
fix(ui): validate OOBM is enabled before allowing HA on KVM hosts (#13605)#13647Chinmay048 wants to merge 2 commits into
Conversation
|
@kiranchavala a Jenkins job has been kicked to build UI QA env. I'll keep you posted as I make progress. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #13647 +/- ##
============================================
- Coverage 19.65% 19.64% -0.01%
+ Complexity 19792 19789 -3
============================================
Files 6368 6368
Lines 575107 575119 +12
Branches 70370 70373 +3
============================================
- Hits 113016 112987 -29
- Misses 449808 449849 +41
Partials 12283 12283
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
UI build: ✔️ |
|
@blueorangutan package |
|
@kiranchavala a [SL] Jenkins job has been kicked to build packages. It will be bundled with no SystemVM templates. I'll keep you posted as I make progress. |
|
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 18620 |
|
cc @weizhouapache @winterhazel Consider this UI improvement for the 4.23 release |
kiranchavala
left a comment
There was a problem hiding this comment.
|
@Chinmay048 when admin clicks on Disable OOBM ,cloudstack should thrown a pop-up saying that to Disable HA First Only if the HA is disabled we should allow to disable the OOBM
|
|
Thanks for the review and feedback @kiranchavala! That makes complete sense to guard the teardown flow as well. I am working on updating the Disable OOBM action right now so that if a host currently has High Availability (HA) enabled, the UI will intercept the action and display a warning pop-up instructing the admin to disable HA first before allowing OOBM to be turned off. Will push the commit to this PR shortly! |
586999a to
068213b
Compare
|
@blueorangutan package |
|
@kiranchavala a [SL] Jenkins job has been kicked to build packages. It will be bundled with no SystemVM templates. I'll keep you posted as I make progress. |
|
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 18634 |
@kiranchavala I intend to cut a RC2 tomorrow around 2026-07-22 16:00 GMT. I will include this patch if it is ready by then. This issue is not major to block 4.23 RC2, as it does not prevent any operations via the UI or result in any bugs. The patch needs some adjustments as well (I'll send some reviews later). |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (3)
ui/src/components/view/ActionButton.vue:181
execActionreferencesthis.item, butActionButtondoesn't define anitemprop/data/computed. This meansrecordwill never fall back to the clicked row item and will also trigger Vue warnings about accessing undefined instance properties. Prefer derivingrecordfromresourceand assigningaction.resourcefrom the same value to keep downstream action handling consistent.
execAction (action) {
action.resource = this.resource
const record = this.resource || this.item
if (action?.api === 'disableOutOfBandManagementForHost' && (record?.hostha?.haenable === true || record?.hastate === 'Enabled')) {
ui/src/components/view/ListView.vue:658
- The
<template v-if="column.key === 'clustername'">line lost its indentation, which makes this block inconsistent with the surrounding template and may violate Vue/ESLint formatting rules.
<template v-if="column.key === 'clustername'">
ui/src/components/view/ListView.vue:696
- The updated account-column rendering has two functional regressions: (1) for
PrjAcct-*values outside/quotasummary, nothing is rendered (nov-elsefallback), leaving the cell blank; (2) the/quotasummarylink is created even whenrecord.accountidis missing and without the previous 404-route guard, which can produce links to invalid routes.
<template v-if="text">
<template v-if="!text.startsWith('PrjAcct-')">
<router-link
v-if="$route.path.startsWith('/quotasummary')"
:to="{ path: `${$route.path}/${record.accountid}` }">{{ text }}</router-link>
winterhazel
left a comment
There was a problem hiding this comment.
@Chinmay048 I left a few comments. I think this can go into 4.20.4 too, could you check and rebase into branch 4.20 if that is indeed the case?
Also, it would be nice to add the same checks to the enableHAForHost, configureHAForHost and disableOutOfBandManagementForHost APIs.
068213b to
4c78cd7
Compare
|
I have pushed a new update to enforce the backend API validation. The DisableOutOfBandManagementForHostCmd now correctly checks haConfigManager.listHAResources to prevent disabling OOBM if HA is active on a KVM host. All local Checkstyle and compilation errors have been resolved. Waiting on the CI simulator tests to complete! |
|
This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch. |
@kiranchavala I am leaving this patch for the next |
|
@Chinmay048 can you resolve the conflicts and rebase onto the 4.20 LTS branch please? |
|
@Chinmay048 could you please address the conflicts |
eaad0f3 to
cf15673
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.
Suppressed comments (7)
ui/src/config/section/infra/hosts.js:201
- This new UI guard hides the Disable OOBM action when Host HA is enabled on KVM, but it doesn’t implement the PR/issue requirement of hiding (or blocking) the Configure HA / Enable HA actions when OOBM is not enabled on KVM hosts. Either update the HA action
showpredicates (e.g., forconfigureHAForHost/enableHAForHost) to requirerecord?.outofbandmanagement?.enabled === trueon KVM, or adjust the PR description to match the actual UI change.
show: (record) => {
if (record.hypervisor === 'KVM' && record?.hostha?.haenable === true) {
return false
}
return record?.outofbandmanagement?.enabled === true
api/src/main/java/org/apache/cloudstack/api/command/admin/outofbandmanagement/DisableOutOfBandManagementForHostCmd.java:84
listHAResources(...)can return multiple HAConfig entries and the order is not guaranteed; checking onlyhaConfigs.get(0)can allow disabling OOBM even when another HAConfig for the host is enabled. This should reject the operation if any Host HA config is enabled.
if (host.getHypervisorType() == HypervisorType.KVM) {
java.util.List<org.apache.cloudstack.ha.HAConfig> haConfigs = haConfigManager.listHAResources(host.getId(), HAResource.ResourceType.Host);
if (haConfigs != null && !haConfigs.isEmpty()) {
if (haConfigs.get(0).isEnabled()) {
throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Cannot disable Out-of-Band Management (OOBM) because HA is currently enabled on this KVM host. Please disable HA first.");
api/src/main/java/org/apache/cloudstack/api/command/admin/ha/ConfigureHAForHostCmd.java:112
- Same as
EnableHAForHostCmd: this OOBM prerequisite only checksHypervisorType.KVM, but the underlying KVM HA provider also targets LXC. This can allow configuring Host HA for LXC without OOBM enabled.
if (host.getHypervisorType() == HypervisorType.KVM) {
if (!outOfBandManagementService.isOutOfBandManagementEnabled(host)) {
throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Cannot configure HA on KVM host because Out-of-Band Management (OOBM) is not enabled.");
}
}
api/src/main/java/org/apache/cloudstack/api/command/admin/ha/EnableHAForHostCmd.java:42
- Import ordering is inconsistent within this file:
com.cloud.*imports are grouped first, butcom.cloud.hypervisor.Hypervisor.HypervisorTypeis placed after theorg.apache.*imports. This can break style checks and reduces readability; keepcom.cloud.*imports together.
import org.apache.cloudstack.context.CallContext;
import org.apache.cloudstack.ha.HAConfigManager;
import org.apache.cloudstack.ha.HAResource;
import com.cloud.hypervisor.Hypervisor.HypervisorType;
import org.apache.cloudstack.outofbandmanagement.OutOfBandManagementService;
import javax.inject.Inject;
api/src/main/java/org/apache/cloudstack/api/command/admin/ha/EnableHAForHostCmd.java:104
- The new OOBM prerequisite is applied only to
HypervisorType.KVM, butKVMHAProvidertreats both KVM and LXC hosts as eligible only when OOBM is enabled. As-is, the API can still enable/configure Host HA on LXC without OOBM, leading to an invalid HA configuration.
// --- YOUR NEW GUARDRAIL ---
if (host.getHypervisorType() == HypervisorType.KVM) {
if (!outOfBandManagementService.isOutOfBandManagementEnabled(host)) {
throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Cannot enable HA on KVM host because Out-of-Band Management (OOBM) is not enabled.");
}
api/src/main/java/org/apache/cloudstack/api/command/admin/ha/ConfigureHAForHostCmd.java:45
- Import ordering/formatting is inconsistent here (extra blank line, and
com.cloud.hypervisor...is placed afterorg.apache...). Keepingcom.cloud.*imports grouped beforeorg.apache.*aligns with the existing style in this file and avoids potential style-check failures.
import org.apache.cloudstack.ha.HAConfigManager;
import org.apache.cloudstack.ha.HAResource;
import org.apache.cloudstack.outofbandmanagement.OutOfBandManagementService;
import com.cloud.hypervisor.Hypervisor.HypervisorType;
import javax.inject.Inject;
api/src/main/java/org/apache/cloudstack/api/command/admin/outofbandmanagement/DisableOutOfBandManagementForHostCmd.java:43
com.cloud.hypervisor.Hypervisor.HypervisorTypeis acom.cloud.*import but is placed after theorg.apache.*imports. This breaks the existing import grouping in this file (all othercom.cloud.*imports are at the top) and can trigger style-check failures; please keepcom.cloud.*imports together.
import org.apache.cloudstack.outofbandmanagement.OutOfBandManagementService;
import org.apache.cloudstack.ha.HAConfigManager;
import com.cloud.hypervisor.Hypervisor.HypervisorType;
import org.apache.cloudstack.ha.HAResource;
|
@DaanHoogland @kiranchavala I have resolved the conflicts by rebasing onto the 4.20 LTS branch and updated the PR base. |




Description
Closes #13605
This PR updates the Vue UI infrastructure configuration (
hosts.js) to validate that Out-of-Band Management (OOBM) is active and enabled before allowing administrators to configure or enable High Availability (HA) on KVM hosts. If OOBM is not enabled on a KVM host, the HA action buttons are cleanly hidden to prevent invalid configurations.Types of changes
Feature/Enhancement Scale or Bug Severity
Bug Severity
How Has This Been Tested?
record.outofbandmanagement.enabledis false or undefined, the "Configure HA" and "Enable HA" action buttons are properly hidden.